package com.wuyou.mid;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Description 672. 灯泡开关 Ⅱ
 * @Author 无忧
 * @Date 2022/9/15 9:51
 */
public class FlipLights {

    public static void main(String[] args) {
        FlipLights flipLights = new FlipLights();
        int n = 1, presses = 2;
        System.out.println(flipLights.solution_1(n, presses));
    }

    public int solution_1(int n, int presses) {

        // 0 关 1开
        switch (n){
            case 0:
                return 1;
            case 1:
                return presses > 0 ? 2 : 1;
            case 2:
                return presses == 0 ? 1 : (presses == 1 ? n + 1 : (presses > 1 ? 4 : 1));
        }
        switch (presses){
            case 0:
                return 1;
            case 1:
                return (n >= 3  && presses >= 3) ? 8 : n + 1;
            case 2:
                return (n >= 3 && presses >= 3) ? 8 : n + 1;
        }
        return 8;
    }
}
